home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / AUTOCK3.PAK / AUTOCLIK.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  6KB  |  208 lines

  1. // AutoClik.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "AutoClik.h"
  15.  
  16. #include "MainFrm.h"
  17. #include "ChildFrm.h"
  18. #include "AClikDoc.h"
  19. #include "AClikVw.h"
  20.  
  21. #ifdef _DEBUG
  22. #define new DEBUG_NEW
  23. #undef THIS_FILE
  24. static char THIS_FILE[] = __FILE__;
  25. #endif
  26.  
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CAutoClickApp
  29.  
  30. BEGIN_MESSAGE_MAP(CAutoClickApp, CWinApp)
  31.     //{{AFX_MSG_MAP(CAutoClickApp)
  32.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  33.         // NOTE - the ClassWizard will add and remove mapping macros here.
  34.         //    DO NOT EDIT what you see in these blocks of generated code!
  35.     //}}AFX_MSG_MAP
  36.     // Standard file based document commands
  37.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  38.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  39.     // Standard print setup command
  40.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  41. END_MESSAGE_MAP()
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CAutoClickApp construction
  45.  
  46. CAutoClickApp::CAutoClickApp()
  47. {
  48.     // TODO: add construction code here,
  49.     // Place all significant initialization in InitInstance
  50. }
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // The one and only CAutoClickApp object
  54.  
  55. CAutoClickApp theApp;
  56.  
  57. // This identifier was generated to be statistically unique for your app.
  58. // You may change it if you prefer to choose a specific identifier.
  59.  
  60. // {47D53E03-CC33-11CE-8F35-00DD01109044}
  61. static const CLSID clsid =
  62. { 0x47d53e03, 0xcc33, 0x11ce, { 0x8f, 0x35, 0x0, 0xdd, 0x1, 0x10, 0x90, 0x44 } };
  63.  
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CAutoClickApp initialization
  66.  
  67. BOOL CAutoClickApp::InitInstance()
  68. {
  69.     // Initialize OLE libraries
  70.     if (!AfxOleInit())
  71.     {
  72.         AfxMessageBox(IDP_OLE_INIT_FAILED);
  73.         return FALSE;
  74.     }
  75.  
  76.     // Standard initialization
  77.     // If you are not using these features and wish to reduce the size
  78.     //  of your final executable, you should remove from the following
  79.     //  the specific initialization routines you do not need.
  80.  
  81. #ifdef _AFXDLL
  82.     Enable3dControls();                     // Call this when using MFC in a shared DLL
  83. #else
  84.     Enable3dControlsStatic();       // Call this when linking to MFC statically
  85. #endif
  86.  
  87.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  88.  
  89.     // Register the application's document templates.  Document templates
  90.     //  serve as the connection between documents, frame windows and views.
  91.  
  92.     CMultiDocTemplate* pDocTemplate;
  93.     pDocTemplate = new CMultiDocTemplate(
  94.         IDR_ACLICKTYPE,
  95.         RUNTIME_CLASS(CAutoClickDoc),
  96.         RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  97.         RUNTIME_CLASS(CAutoClickView));
  98.     AddDocTemplate(pDocTemplate);
  99.  
  100.     // Connect the COleTemplateServer to the document template.
  101.     //  The COleTemplateServer creates new documents on behalf
  102.     //  of requesting OLE containers by using information
  103.     //  specified in the document template.
  104.     m_server.ConnectTemplate(clsid, pDocTemplate, FALSE);
  105.  
  106.     // Register all OLE server factories as running.  This enables the
  107.     //  OLE libraries to create objects from other applications.
  108.     COleTemplateServer::RegisterAll();
  109.         // Note: MDI applications register all server objects without regard
  110.         //  to the /Embedding or /Automation on the command line.
  111.  
  112.     // create main MDI Frame window
  113.     CMainFrame* pMainFrame = new CMainFrame;
  114.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  115.         return FALSE;
  116.     m_pMainWnd = pMainFrame;
  117.  
  118.     // Enable drag/drop open
  119.     m_pMainWnd->DragAcceptFiles();
  120.  
  121.     // Enable DDE Execute open
  122.     EnableShellOpen();
  123.     RegisterShellFileTypes(TRUE);
  124.  
  125.     // Parse command line for standard shell commands, DDE, file open
  126.     CCommandLineInfo cmdInfo;
  127.     ParseCommandLine(cmdInfo);
  128.  
  129.     // Check to see if launched as OLE server
  130.     if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
  131.     {
  132.         // Application was run with /Embedding or /Automation.  Don't show the
  133.         //  main window in this case.
  134.         return TRUE;
  135.     }
  136.  
  137.     // When a server application is launched stand-alone, it is a good idea
  138.     //  to update the system registry in case it has been damaged.
  139.     m_server.UpdateRegistry(OAT_DISPATCH_OBJECT);
  140.     COleObjectFactory::UpdateRegistryAll();
  141.  
  142.     // Dispatch commands specified on the command line
  143.     if (!ProcessShellCommand(cmdInfo))
  144.         return FALSE;
  145.  
  146.     // The main window has been initialized, so show and update it.
  147.     pMainFrame->ShowWindow(m_nCmdShow);
  148.     pMainFrame->UpdateWindow();
  149.  
  150.     return TRUE;
  151. }
  152.  
  153. /////////////////////////////////////////////////////////////////////////////
  154. // CAboutDlg dialog used for App About
  155.  
  156. class CAboutDlg : public CDialog
  157. {
  158. public:
  159.     CAboutDlg();
  160.  
  161. // Dialog Data
  162.     //{{AFX_DATA(CAboutDlg)
  163.     enum { IDD = IDD_ABOUTBOX };
  164.     //}}AFX_DATA
  165.  
  166.     // ClassWizard generated virtual function overrides
  167.     //{{AFX_VIRTUAL(CAboutDlg)
  168.     protected:
  169.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  170.     //}}AFX_VIRTUAL
  171.  
  172. // Implementation
  173. protected:
  174.     //{{AFX_MSG(CAboutDlg)
  175.         // No message handlers
  176.     //}}AFX_MSG
  177.     DECLARE_MESSAGE_MAP()
  178. };
  179.  
  180. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  181. {
  182.     //{{AFX_DATA_INIT(CAboutDlg)
  183.     //}}AFX_DATA_INIT
  184. }
  185.  
  186. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  187. {
  188.     CDialog::DoDataExchange(pDX);
  189.     //{{AFX_DATA_MAP(CAboutDlg)
  190.     //}}AFX_DATA_MAP
  191. }
  192.  
  193. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  194.     //{{AFX_MSG_MAP(CAboutDlg)
  195.         // No message handlers
  196.     //}}AFX_MSG_MAP
  197. END_MESSAGE_MAP()
  198.  
  199. // App command to run the dialog
  200. void CAutoClickApp::OnAppAbout()
  201. {
  202.     CAboutDlg aboutDlg;
  203.     aboutDlg.DoModal();
  204. }
  205.  
  206. /////////////////////////////////////////////////////////////////////////////
  207. // CAutoClickApp commands
  208.